﻿<Window x:Class="MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DBScriptRunner.Windows"
    xmlns:mru="clr-namespace:Common;assembly=RecentFileListLib"
    xmlns:client="clr-namespace:DBScriptRunner.Client;assembly=DBScriptRunner.Client"
    xmlns:properties="clr-namespace:DBScriptRunner.Windows.My.Resources"
    Background="Gray" 
        Foreground="White"
    Title="Script Runner" Height="417" Width="781" Name="mainWindow" Icon="/DBScriptRunner;component/Utility_VBScript.ico">
    
    <!--Background="{x:Static SystemColors.WindowBrush}"-->



    <!--<Window.Background>
        <LinearGradientBrush EndPoint="0.713,1" StartPoint="0.713,-0.3">
            <GradientStop Color="#FFFFFFFF" Offset="0.933" />
            <GradientStop Color="CornflowerBlue" Offset="0.337" />
        </LinearGradientBrush>
    </Window.Background>-->

    <Window.Resources>
        <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type client:ScriptTypes}" x:Key="scriptTypes">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="client:ScriptTypes" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <!-- 
            Got this style / approach from: 
            http://apocryph.org/2007/08/26/rendering_disabled_grayed_out_image_buttons_wpf/ 
        -->    
        <Style TargetType="{x:Type Image}" x:Key="toolbarImageStyle">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                    <Setter Property="Opacity" Value="0.50"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <Style TargetType="{x:Type Image}" x:Key="menuItemImageStyle">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuItem}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                    <Setter Property="Opacity" Value="0.50"></Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <Style TargetType="{x:Type TextBlock}" x:Key="propertyLabel">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Foreground" Value="White" />
            <!--<Setter Property="BitmapEffect">
                <Setter.Value>
                <DropShadowBitmapEffect
                      ShadowDepth="4"
                      Direction="330"
                      Color="Black"
                      Opacity="0.25"
                      Softness="0" />    
                </Setter.Value>
            </Setter>-->
        </Style>

        <Style TargetType="{x:Type Label}" x:Key="header">
            <Style.Setters>
                <Setter Property="Foreground" Value="White" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="FontFamily" Value="Agency FB" />
                <Setter Property="FontSize" Value="15" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Label">
                            <Grid >
                                <Rectangle  Fill="#FF2E2E2E" />

                                <ContentPresenter Margin="4"
            
            RecognizesAccessKey="True"/>

                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style.Setters>
        </Style>


    </Window.Resources>
    
    <Window.CommandBindings>
        <CommandBinding Command="Open" x:Name="Open" CanExecute="Open_CanExecute" Executed="Open_Executed" />
        <CommandBinding Command="Save" x:Name="Save" CanExecute="Save_CanExecute" Executed="Save_Executed" />
        <CommandBinding Command="New" x:Name="New" CanExecute="New_CanExecute" Executed="New_Executed" />
        <CommandBinding Command="SaveAs" x:Name="SaveAs" CanExecute="SaveAs_CanExecute" Executed="SaveAs_Executed" />
        <CommandBinding Command="Close" CanExecute="Close_CanExecute" Executed="Close_Executed" />
        <CommandBinding Command="local:ScriptRunnerCommands.ExecuteAll" CanExecute="ExecuteAll_CanExecute" Executed="ExecuteAll_Executed" />
    </Window.CommandBindings>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Menu FontWeight="Normal" ForceCursor="True">
            <MenuItem Header="File">
                <MenuItem Header="New" Command="New"></MenuItem>
                <MenuItem Header="Open" Command="Open"></MenuItem>
                <MenuItem Header="Save" Command="Save"></MenuItem>
                <MenuItem Header="Save As..." Command="SaveAs"></MenuItem>

                <mru:RecentFileList x:Name="RecentFileList" MenuClick="RecentFileList_MenuClick" />

                <MenuItem Header="Close" Command="Close"></MenuItem>
            </MenuItem>
            <MenuItem Header="Edit">
                <MenuItem Header="Cut" Command="Cut" />
                <MenuItem Header="Copy" Command="Copy" />
                <MenuItem Header="Paste" Command="Paste" />
                <Separator />
                <MenuItem Header="Delete" Command="Delete" />
            </MenuItem>
            <MenuItem Header="Tools">
                <MenuItem Command="local:ScriptRunnerCommands.ExecuteAll" Header="Execute All Scripts..." x:Name="ExecuteAllScripts"  CommandTarget="{Binding ElementName=mainWindow}" >
                    <MenuItem.Icon>
                        <Image Width="16" Source="/DBScriptRunner;component/Images/Play.png" Style="{StaticResource menuItemImageStyle}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="Options..." Click="OptionsMenuItem_Click"  />
                <!--<MenuItem Header="Fix" x:Name="MenuFix" Click="MenuFix_Click" /> -->
            </MenuItem>
            <MenuItem Header="Help">
                <MenuItem Header="About..." Click="AboutMenuItem_Click" />
            </MenuItem>
        </Menu>
        
        <!-- This is the main layout grid -->
        <Grid Grid.Row="1"> 
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="4" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>            
            
            <!-- Small grid for the Project name -->
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="2" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="2" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <TextBlock Style="{StaticResource propertyLabel}" Margin="2" VerticalAlignment="Center" Grid.Row="2">
                    Connection String
                </TextBlock>
                <TextBox BorderThickness="0" x:Name="ConnectionStringTextBox" VerticalAlignment="Center" Grid.Column="1" Margin="2" Grid.Row="2" ToolTip="This is the connection string to use.">
                    
                </TextBox>
                
                <TextBlock Style="{StaticResource propertyLabel}" Margin="2" VerticalAlignment="Center" Grid.Row="4">
                    <Hyperlink ToolTip="Click to explore this folder" Foreground="White" Click="BaseDirectoryLink_Click">Base Directory</Hyperlink>
                </TextBlock>
                
                <Grid Grid.Column="1" Grid.Row="4" VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="2" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    
                    <TextBox BorderThickness="0" Text="{Binding Path=Options.BaseDirectory}" x:Name="BaseDirectoryTextBox" VerticalAlignment="Center" Margin="2" ToolTip="This is the base directory to use when using relative paths for file based scripts."></TextBox>    
                    <Button  Style="{StaticResource SubmitButton}" MinWidth="0" Width="20" Grid.Column="2" VerticalAlignment="Center" x:Name="BaseDirectoryButton">...</Button>
                </Grid>
                
                
            </Grid>
            
            <!-- This is the grid that splits the big middle row -->
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="40*" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="40*" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="60*" />
                </Grid.ColumnDefinitions>
                
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Label Style="{StaticResource header}" ToolTip="Scripts are organized into groups. These are those groups.">Script Groups</Label>

                    <ToolBar Grid.Row="1">

                        <Button ToolTip="Insert a new Script Group" Command="local:ScriptRunnerCommands.Insert"  CommandTarget="{Binding ElementName=lbScriptGroups}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/NewFolder.png" Style="{StaticResource toolbarImageStyle}"  />
                        </Button>
                        <Button ToolTip="Delete a Script Group" Command="Delete"  CommandTarget="{Binding ElementName=lbScriptGroups}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/Delete.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        <Separator />
                        <Button ToolTip="Execute a script group" Command="local:ScriptRunnerCommands.ExecuteScriptGroup" CommandTarget="{Binding ElementName=lbScriptGroups}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/Play.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        
                        <Separator />
                      
                        <Button ToolTip="Move the selected script down" Command="local:ScriptRunnerCommands.MoveListItemDown" CommandTarget="{Binding ElementName=lbScriptGroups}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowDown.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        <Button ToolTip="Move the selected script up" Command="local:ScriptRunnerCommands.MoveListItemUp" CommandTarget="{Binding ElementName=lbScriptGroups}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowUp.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>

                        <!-- <Separator />
                        <Button ToolTip="Move the selected script up" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowUp.png" />
                        </Button>
                        <Button ToolTip="Move the selected script down" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowDown.png" />
                        </Button>-->
                    </ToolBar>

                    <ListBox Background="Transparent" Foreground="White" Grid.Row="2" x:Name="lbScriptGroups" ItemsSource="{Binding Path=ScriptGroups}" DisplayMemberPath="Name">



                        <ListBox.CommandBindings>
                            <CommandBinding Command="local:ScriptRunnerCommands.Rename" CanExecute="RenameScriptGroup_CanExecute" Executed="RenameScriptGroup_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.ExecuteScriptGroup" x:Name="ExecuteScriptGroup" CanExecute="ExecuteScriptGroup_CanExecute" Executed="ExecuteScriptGroup_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.Insert" x:Name="ScriptGroupInsert" CanExecute="ScriptGroupInsert_CanExecute" Executed="ScriptGroupInsert_Executed" />
                            
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemUp" x:Name="MoveScriptGroupUp" CanExecute="MoveScriptGroupUp_CanExecute" Executed="MoveScriptGroupUp_Executed"  />
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemDown" x:Name="MoveScriptGroupDown"  CanExecute="MoveScriptGroupDown_CanExecute" Executed="MoveScriptGroupDown_Executed"/>
                            
                            <CommandBinding Command="Delete" x:Name="DeleteScriptGroup" CanExecute="DeleteScriptGroup_CanExecute" Executed="DeleteScriptGroup_Executed" />
                            
                        </ListBox.CommandBindings>
                        <ListBox.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Execute Script Group..." Command="local:ScriptRunnerCommands.ExecuteScriptGroup" CommandTarget="{Binding ElementName=lbScriptGroups}" >
                                    <MenuItem.Icon>
                                        <Image Width="16" Source="/DBScriptRunner;component/Images/Play.png" Style="{StaticResource menuItemImageStyle}" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="Rename"  Command="local:ScriptRunnerCommands.Rename" CommandTarget="{Binding ElementName=lbScriptGroups}" /> 
                                <Separator />
                                <MenuItem Header="Delete" Command="Delete" CommandTarget="{Binding ElementName=lbScriptGroups}" />
                                <Separator />
                                <MenuItem Header="Move Up" Command="local:ScriptRunnerCommands.MoveListItemUp" CommandTarget="{Binding ElementName=lbScriptGroups}" />
                                <MenuItem Header="Move Down " Command="local:ScriptRunnerCommands.MoveListItemDown" CommandTarget="{Binding ElementName=lbScriptGroups}" />
                                
                               
                                
                            </ContextMenu>
                        </ListBox.ContextMenu>
                    </ListBox>
                </Grid>
                
                <GridSplitter BorderThickness="0" Background="#FF2E2E2E" Grid.Column="1" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" />

                <Grid Grid.Column="2">
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Label  Style="{StaticResource header}" ToolTip="A script can be a script file, a directory of scripts, or a hardcoded script." Content="{x:Static properties:UIStrings.Scripts}" />
                    
                    <ToolBar Grid.Row="1">
                        
                        <Button ToolTip="Insert a new Script.  Note that you can also drag files from Windows Explorer to the list below." Command="local:ScriptRunnerCommands.Insert" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/NewScript.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        
                        <Button ToolTip="Insert a new Script" Command="Delete" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/Delete.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        
                        <Separator />
                        <Button ToolTip="Execute one or more individual scripts" Command="local:ScriptRunnerCommands.ExecuteScript" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/Play.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        
                        <Separator />
                        
                        <Button ToolTip="Move the selected script down" Command="local:ScriptRunnerCommands.MoveListItemDown" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowDown.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        <Button ToolTip="Move the selected script up" Command="local:ScriptRunnerCommands.MoveListItemUp" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/ArrowUp.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        
                        <Separator />
                        
                        <Button ToolTip="Move the selected script to the buttom" Command="local:ScriptRunnerCommands.MoveListItemToBottom" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/MoveToBottom.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                        <Button ToolTip="Move the selected script to the top" Command="local:ScriptRunnerCommands.MoveListItemToTop" CommandTarget="{Binding ElementName=lbScripts}" >
                            <Image Width="16" Source="/DBScriptRunner;component/Images/MoveToTop.png" Style="{StaticResource toolbarImageStyle}" />
                        </Button>
                    </ToolBar>
                    
                    <ListBox Foreground="White" Background="Transparent" Grid.Row="2" x:Name="lbScripts" ItemsSource="{Binding ElementName=lbScriptGroups, Path=SelectedItem.Scripts}" DisplayMemberPath="Name" AllowDrop="True" SelectionMode="Extended">
                        
                        <ListBox.CommandBindings>
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveScripts" CanExecute="Scripts_Move_CanExecute" Executed="Scripts_Move_Executed"  />
                            <CommandBinding Command="local:ScriptRunnerCommands.Insert" CanExecute="ScriptInsert_CanExecute" Executed="ScriptInsert_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.ExecuteScript" CanExecute="ExecuteScript_CanExecute" Executed="ExecuteScript_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemUp" CanExecute="MoveScriptUp_CanExecute" Executed="MoveScriptUp_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemDown" CanExecute="MoveScriptDown_CanExecute" Executed="MoveScriptDown_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemToTop" CanExecute="MoveScriptToTop_CanExecute" Executed="MoveScriptToTop_Executed" />
                            <CommandBinding Command="local:ScriptRunnerCommands.MoveListItemToBottom" CanExecute="MoveScriptToBottom_CanExecute" Executed="MoveScriptToBottom_Executed" />
                            <CommandBinding Command="Delete" x:Name="DeleteScript" CanExecute="DeleteScript_CanExecute" Executed="DeleteScript_Executed" />
                        </ListBox.CommandBindings>

                        <ListBox.ContextMenu>
                            <ContextMenu>
                                <MenuItem Header="Execute Script..." Command="local:ScriptRunnerCommands.ExecuteScript" CommandTarget="{Binding ElementName=lbScripts}" >
                                    <MenuItem.Icon>
                                        <Image Width="16" Source="/DBScriptRunner;component/Images/Play.png" Style="{StaticResource menuItemImageStyle}" />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem Header="Rename"  Command="local:ScriptRunnerCommands.Rename" CommandTarget="{Binding ElementName=lbScripts}" />
                                <Separator />
                                <MenuItem Header="Delete" Command="Delete" CommandTarget="{Binding ElementName=lbScripts}" />
                                <Separator />
                                <MenuItem Header="Move Up" Command="local:ScriptRunnerCommands.MoveListItemUp" CommandTarget="{Binding ElementName=lbScripts}" />
                                <MenuItem Header="Move Down " Command="local:ScriptRunnerCommands.MoveListItemDown" CommandTarget="{Binding ElementName=lbScripts}" />

                                <Separator />
                                <MenuItem Header="Move to another group..." Command="local:ScriptRunnerCommands.MoveScripts" CommandTarget="{Binding ElementName=lbScripts}" />
                            </ContextMenu>
                        </ListBox.ContextMenu>
                    </ListBox>

                 
                </Grid>

                <GridSplitter  BorderThickness="0" Background="#FF2E2E2E" Grid.Column="3" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" />
                
                <Grid Grid.Column="4">
                    
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    
                    <Label Style="{StaticResource header}">Script Properties</Label>
                
                    <!-- This is the property sheet -->
                    <Grid Grid.Row="1" Margin="3,0,2,2" DataContextChanged="ScriptGrid_DataContextChanged" x:Name="ScriptGrid" DataContext="{Binding ElementName=lbScripts, Path=SelectedItem}" >


                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="4"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        
                        
                        
                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Center" Grid.Row="1">Name</TextBlock>
                        <TextBox BorderThickness="0" x:Name="ScriptNameTextBox" Grid.Row="1" Margin="2" Grid.Column="2" Text="{Binding Path=Name}" ToolTip="This is the arbitrary (friendly) name for the script"></TextBox>
                        
                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Center" Grid.Row="2" ToolTip="This is the type of script">Type</TextBlock>
                        <ComboBox BorderThickness="0"  SelectionChanged="ScriptTypeCombo_SelectionChanged" x:Name="ScriptTypeCombo" Margin="2" Grid.Row="2" Grid.Column="2" ItemsSource="{Binding Source={StaticResource scriptTypes}}" SelectedItem="{Binding Path=ScriptType}"></ComboBox>
                        
                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Center" Grid.Row="3">
                            <Hyperlink Foreground="White" Click="FileLink_Click">File</Hyperlink>
                        </TextBlock>
                        <Grid Grid.Row="3" Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition  Width="*" />
                                <ColumnDefinition  Width="2" />
                                <ColumnDefinition  Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBox BorderThickness="0" x:Name="ScriptFileNameTextBox" Margin="2" Text="{Binding Path=FileName}" ToolTip="This is the script file to execute." HorizontalAlignment="Stretch" ></TextBox>    
                            <Button Style="{StaticResource SubmitButton}" MinWidth="0" Width="20" Grid.Column="2" x:Name="BrowseForScriptButton" ToolTip="Click here to browse for a file" Height="23.277" VerticalAlignment="Top">...</Button>
                        </Grid>

                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Center" Grid.Row="4">
                            <Hyperlink Foreground="White" Click="ScriptDirectoryLink_Click">Directory</Hyperlink>
                        </TextBlock>
                        <Grid Grid.Row="4" Grid.Column="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition  Width="*" />
                                <ColumnDefinition  Width="2" />
                                <ColumnDefinition  Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBox BorderThickness="0" x:Name="ScriptDirectoryTextBox" Margin="2" Text="{Binding Path=Directory}" ToolTip="This is the directory to load the scripts from"></TextBox>
                            <Button  Style="{StaticResource SubmitButton}" MinWidth="0" Width="20" Grid.Column="2" x:Name="BrowseForScriptDirectoryButton" ToolTip="Click here to browse for a directory">...</Button>
                        </Grid>
                        
                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Center" Grid.Row="5">Filter</TextBlock>
                        <TextBox BorderThickness="0" x:Name="ScriptFilterTextBox" 
                                 ToolTip="This is the search string to use (e.g. &quot;*.prc,*.sql&quot;)"
                                 Margin="2" 
                                 Grid.Column="2" 
                                 Text="{Binding Path=Filter}" 
                                 Grid.Row="5" />

                        <TextBlock Style="{StaticResource propertyLabel}" VerticalAlignment="Top" Grid.Row="6">Command Text</TextBlock>
                        <TextBox x:Name="ScriptCommandTextTextBox" 
                                 BorderThickness="0"
                                 AcceptsReturn="True" 
                                 FontFamily="Courier New" 
                                 AcceptsTab="True" 
                                 TextWrapping="NoWrap"  
                                 VerticalScrollBarVisibility="Visible" 
                                 HorizontalScrollBarVisibility="Auto" 
                                 Margin="2" 
                                 Grid.Column="2" 
                                 Text="{Binding Path=CommandText}" Grid.Row="6"></TextBox>
                    </Grid>
                    
                </Grid>
                
            </Grid>
            
        </Grid>
        
        <StatusBar Grid.Row="2" Background="#FF2E2E2E">
            <StatusBarItem Foreground="White">Ready</StatusBarItem>
        </StatusBar>

    </Grid>
    
   
</Window>
